x86: remove IS_PRIV access check bypasses
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 18 Apr 2013 15:01:45 +0000 (17:01 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 18 Apr 2013 15:01:45 +0000 (17:01 +0200)
Several domctl functions dealing with rangesets contain a short-circuit
bypass if the domain is privileged. Since the construction of domain 0
permits access to all I/O ranges, the call to irq_access_permitted will
normally return true even without the IS_PRIV check, and the presence of
the IS_PRIV check prevents the creation of a privileged domain without
access to specific devices or IO memory ranges.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
xen/arch/x86/domctl.c
xen/arch/x86/irq.c

index 8fb4fa98a597d5d0233dfb0db3a2b6aac464b4ce..9580390594f86efbc2cb7feeced3b4916b485fe7 100644 (file)
@@ -645,8 +645,7 @@ long arch_do_domctl(
             break;
 
         ret = -EPERM;
-        if ( !IS_PRIV(current->domain) &&
-             !iomem_access_permitted(current->domain, mfn, mfn + nr_mfns - 1) )
+        if ( !iomem_access_permitted(current->domain, mfn, mfn + nr_mfns - 1) )
             break;
 
         ret = xsm_iomem_mapping(XSM_HOOK, d, mfn, mfn + nr_mfns - 1, add);
@@ -723,8 +722,7 @@ long arch_do_domctl(
         }
 
         ret = -EPERM;
-        if ( !IS_PRIV(current->domain) &&
-             !ioports_access_permitted(current->domain, fmp, fmp + np - 1) )
+        if ( !ioports_access_permitted(current->domain, fmp, fmp + np - 1) )
             break;
 
         ret = xsm_ioport_mapping(XSM_HOOK, d, fmp, fmp + np - 1, add);
index bbf413089dfe0218b0e4a8ab2affaddffdb232ab..b0b0c655bddcf0741acc9bf78a232b1441067c54 100644 (file)
@@ -1891,8 +1891,7 @@ int map_domain_pirq(
 
     ASSERT(spin_is_locked(&d->event_lock));
 
-    if ( !IS_PRIV(current->domain) &&
-         !irq_access_permitted(current->domain, irq))
+    if ( !irq_access_permitted(current->domain, irq))
         return -EPERM;
 
     if ( pirq < 0 || pirq >= d->nr_pirqs || irq < 0 || irq >= nr_irqs )